package com.alibaba.nacos.controller;

import com.alibaba.nacos.vo.FeignTestVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


@RestController
public class TestController {
//    @GetMapping("/echo/{str}")
//    public String echo(@PathVariable String str) {
//        return "provider is here " + str;
//    }
@GetMapping("/provider/hello")
public String hello()  {
    try {
        Thread.sleep(1000 * 10);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
    return "provider is here";
}

    @GetMapping("/compress")
    public List<FeignTestVo> compress() {
        List<FeignTestVo> arrayList = new ArrayList<>();
        String str = "compress test!compress test!compress test!compress test!compress test!compress test!compress test!compress test! " +
                "compress test!compress test!compress test!compress test!compress test!compress test!compress test!compress test!" +
                "compress test!compress test!compress test!compress test!compress test!compress test!compress test!compress test!" +
                "compress test!compress test!compress test!compress test!compress test!compress test!compress test!compress test!";
        for (int i = 0; i < 1200; i++) {
            FeignTestVo testVo = new FeignTestVo();
            testVo.setName(str);
            testVo.setSex(1);
            arrayList.add(testVo);
        }
        return arrayList;
    }

}
